﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="DelItemsSuppliers.aspx.cs" Inherits="Items_DelItemsSuppliers" Title="Изтриване на Продукт" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:GridView ID="gvItems" runat="server" AutoGenerateColumns="False" 
        BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" 
        CellPadding="4" DataKeyNames="ItemID" DataSourceID="sdsItems" ForeColor="Black" 
        GridLines="Vertical">
        <FooterStyle BackColor="#CCCC99" />
        <RowStyle BackColor="#F7F7DE" />
        <Columns>
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                        CommandName="Delete" Text="Изтрий" OnClientClick="return confirm('Моля потвърдете, че желаете да изтриете записа!');"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="ItemCode" HeaderText="Код" 
                    SortExpression="ItemCode" />
            <asp:BoundField DataField="NameBG" HeaderText="Име БГ" 
                    SortExpression="NameBG" />
            <asp:BoundField DataField="NameEN" HeaderText="Име АН" 
                    SortExpression="NameEN" />
            <asp:BoundField DataField="EXW1" HeaderText="EXW в ЛВ без обков" 
                SortExpression="EXW1" />
            <asp:BoundField DataField="EXW2" HeaderText="EXW цена на обкова в ЛВ" 
                SortExpression="EXW2" />
            <asp:BoundField DataField="EXW3" HeaderText="EXW цена в ЛВ с обков" 
                SortExpression="EXW3" />
            <asp:BoundField DataField="DDU1_EUR" HeaderText="DDU цена в EUR без обков" 
                SortExpression="DDU1_EUR" />
                <asp:BoundField DataField="DDU2_EUR" HeaderText="DDU цена на обкова в EUR" 
                    SortExpression="DDU2_EUR" />
                <asp:BoundField DataField="DDUEUR" HeaderText="DDU цена с обков в EUR" 
                    SortExpression="DDUEUR" />
                <asp:BoundField DataField="DDUBGN" HeaderText="DDU цена с обков в ЛВ" 
                    SortExpression="DDUBGN" />
                <asp:BoundField DataField="Count1" HeaderText="Бр./Комплект" 
                    SortExpression="Count1" />
                <asp:BoundField DataField="Count2" HeaderText="Комплекти в кашон" 
                    SortExpression="Count2" />
                <asp:BoundField DataField="Count3" HeaderText="Кашони в палет" 
                    SortExpression="Count3" />
                <asp:BoundField DataField="Count4" HeaderText="Комплекти в палет" 
                    SortExpression="Count4" />
        </Columns>
        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
        <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    <asp:SqlDataSource ID="sdsItems" runat="server" 
        ConnectionString="<%$ ConnectionStrings:KonturConnectionString %>" 
        DeleteCommand="DELETE FROM [Items] WHERE [ItemID] = @ItemID" 
        InsertCommand="INSERT INTO [Items] ([ItemCode], [NameBG], [NameEN], [EXW1], [EXW2], [EXW3], [CustomerID], [DDU1_EUR], [DDU2_EUR], [DDUEUR], [DDUBGN], [Count1], [Count2], [Count3], [Count4]) VALUES (@ItemCode, @NameBG, @NameEN, @EXW1, @EXW2, @EXW3, @CustomerID, @DDU1_EUR, @DDU2_EUR, @DDUEUR, @DDUBGN, @Count1, @Count2, @Count3, @Count4)" 
        SelectCommand="SELECT [ItemID], [ItemCode], [NameBG], [NameEN], [EXW1], [EXW2], [EXW3], [SupplierID], [DDU1_EUR], [DDU2_EUR], [DDUEUR], [DDUBGN], [Count1], [Count2], [Count3], [Count4] FROM [Items] WHERE ([SupplierID] = @SupplierID)" 
        
        UpdateCommand="UPDATE [Items] SET [ItemCode] = @ItemCode, [NameBG] = @NameBG, [NameEN] = @NameEN, [EXW1] = @EXW1, [EXW2] = @EXW2, [EXW3] = @EXW3, [CustomerID] = @CustomerID, [DDU1_EUR] = @DDU1_EUR, [DDU2_EUR] = @DDU2_EUR, [DDUEUR] = @DDUEUR, [DDUBGN] = @DDUBGN, [Count1] = @Count1, [Count2] = @Count2, [Count3] = @Count3, [Count4] = @Count4 WHERE [ItemID] = @ItemID">
        <SelectParameters>
            <asp:QueryStringParameter Name="SupplierID" QueryStringField="SupplierID" />
        </SelectParameters>
        <DeleteParameters>
            <asp:Parameter Name="ItemID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="ItemCode" Type="String" />
            <asp:Parameter Name="NameBG" Type="String" />
            <asp:Parameter Name="NameEN" Type="String" />
            <asp:Parameter Name="EXW1" Type="Decimal" />
            <asp:Parameter Name="EXW2" Type="Decimal" />
            <asp:Parameter Name="EXW3" Type="Decimal" />
            <asp:Parameter Name="CustomerID" Type="Int32" />
            <asp:Parameter Name="DDU1_EUR" Type="Decimal" />
            <asp:Parameter Name="DDU2_EUR" Type="Decimal" />
            <asp:Parameter Name="DDUEUR" Type="Decimal" />
            <asp:Parameter Name="DDUBGN" Type="Decimal" />
            <asp:Parameter Name="Count1" Type="Int32" />
            <asp:Parameter Name="Count2" Type="Int32" />
            <asp:Parameter Name="Count3" Type="Int32" />
            <asp:Parameter Name="Count4" Type="Int32" />
            <asp:Parameter Name="ItemID" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="ItemCode" Type="String" />
            <asp:Parameter Name="NameBG" Type="String" />
            <asp:Parameter Name="NameEN" Type="String" />
            <asp:Parameter Name="EXW1" Type="Decimal" />
            <asp:Parameter Name="EXW2" Type="Decimal" />
            <asp:Parameter Name="EXW3" Type="Decimal" />
            <asp:Parameter Name="CustomerID" Type="Int32" />
            <asp:Parameter Name="DDU1_EUR" Type="Decimal" />
            <asp:Parameter Name="DDU2_EUR" Type="Decimal" />
            <asp:Parameter Name="DDUEUR" Type="Decimal" />
            <asp:Parameter Name="DDUBGN" Type="Decimal" />
            <asp:Parameter Name="Count1" Type="Int32" />
            <asp:Parameter Name="Count2" Type="Int32" />
            <asp:Parameter Name="Count3" Type="Int32" />
            <asp:Parameter Name="Count4" Type="Int32" />
        </InsertParameters>
    </asp:SqlDataSource>
</asp:Content>

